#include "VelocityMatch.h"
#include "Agent.h"

namespace Engine
{
	void VelocityMatch::Update(SteeringOutput* output)
	{
		output ->linear = m_target ->GetVel() - m_parent ->GetVel();
		output ->linear /= m_timeToTarget;

		if(output ->linear.SquaredLength() > m_parent ->GetMaxSpeedSquared())
		{
			output ->linear.Normalize();
			output ->linear *= m_parent ->GetMaxSpeed();
		}
	}
}